package top.huiwow.utils;

import top.huiwow.GameCore;

public class DamageCalculator {
    public static double calculateNormalAttack(double baseDamage, double strength, int cc, double cd) {
        double finalDamage;
        boolean crit = GameCore.getRandom().nextInt(cc) <= 100;
        if (crit) {
            finalDamage = (baseDamage + 5) * (1 + strength / 100f) * (1 + cd / 100f);
        } else {
            finalDamage = (baseDamage + 5) * (1 + strength / 100f);
        }
        return finalDamage;
    }

    public static double calculateAbilityDamage(double baseDamage, double intelligence, double scaling, int cc, double cd, double baseMultiplier, double postMultiplier) {
        double finalDamage;
        boolean crit = GameCore.getRandom().nextInt(cc) <= 100;
        if (crit) {
            finalDamage = baseDamage * (1 + (intelligence / 100) * scaling) * (1 + cd / 100) * (1 + baseMultiplier / 100) * (1 + postMultiplier / 100);
        } else {
            finalDamage = baseDamage * (1 + (intelligence / 100) * scaling) * (1 + baseMultiplier / 100) * (1 + postMultiplier / 100);
        }
        return finalDamage;
    }
}
